<!-- 信息列表页 -->
<?php
$rs_one = $DB->DB_GetOne("SELECT groupname,id FROM category WHERE id = '".$cateid."'");
?>
<br><div class="table2">
	&nbsp;<a href="admin.php?file=index">系统首页</a>
	&raquo; <a href="admin.php?file=msg&act=list&sysgroupid=<?php echo $cateid;?>"><?php echo $rs_one['groupname'];?></a>
	&raquo; 列表
	<input type="button" value="添加新<?php echo $rs_one['groupname'];?>" onclick="qgurl('admin.php?file=content&act=add&cateid=<?php echo $cateid;?>')">
</div>
<script src="images/date.js"></script>
<?php
#[添加分类]
if($sysAct == "add")
{
  include_once('manage/tpl/content.htm');
}
elseif($sysAct == "save")
{
	$msg = $STR->safe($_POST);
	$sysgroupid = intval($sysgroupid);
	if($_SESSION["admin"]["typer"] != "system" && !$QG_AP["msg_".$sysgroupid])
	{
		//Error("对不起，您没有权限操作当前功能","admin.php?file=index");
	}
	if(!$msg["catename"])
	{
		//Error("分类名称不能为空","admin.php?file=category&act=add&sysgroupid=".$sysgroupid);
	}

	#[写入数据]
	if($msg["sysgroupid"] !='')
	{
			$DB->DB_Query("UPDATE sysgroup SET groupname = '".$msg["catename"]."' ,note ='".$msg["note"]."',status='".$msg["status"]."',taxis='".$msg["taxis"]."' WHERE id = '".$msg["sysgroupid"]."'" );
			echo '分类信息修改成功...';
	}
	else
	{
			$DB->DB_Query("INSERT INTO sysgroup(groupname,note,status,taxis) VALUES('".$msg["catename"]."','".$msg["note"]."','".$msg["status"]."','".$msg["taxis"]."')");
			echo '分类信息添加成功...';
	}
	exit;
	//Error("分类信息添加成功...","admin.php?file=category&act=list&sysgroupid=".$sysgroupid);
}
elseif($sysAct == "list")
{
?>
		<div class="table">
			<table cellpadding="1" cellspacing="0">
			<form method="post" action="admin.php?file=msg&act=list&sysgroupid={:$sysgroupid}">
			<tr>
				<td>分类：</td>
				<td>
					<select name="cateid" id="cateid">
					<option value="0">选择分类...</option>
					<!-- $catelist AS $key=>$value -->
					<option value="{:$value[id]}"{if($cateid == $value[id])} selected{end}>{:$value[space]}{:$value[catename]}</option>
					<!-- end -->
					</select>
				</td>
				<td>&nbsp;关键字：</td>
				<td><input type="text" name="keywords" id="keywords" value="{:$keywords}"></td>
				<td>&nbsp;时间段：</td>
				<td><input type="text" name="s_time" id="s_time" onClick="javascript:ShowCalendar('s_time')" value="{:$s_time}" class="short_input"></td>
				<td>-</td>
				<td><input type="text" name="e_time" id="e_time" onClick="javascript:ShowCalendar('e_time')" value="{:$e_time}" class="short_input"></td>
				<td>
					<input type="submit" value="搜索" class="mybutton_01">
				</td>
				</form>
			</tr>
			</table>
		</div>
		
		<table width="100%" cellpadding="0" cellspacing="0">
		<tr class="table table2">
			<td height="23px" class="msg_checkbox b_b">&nbsp;</td>
			<td class="msg_subject_id b_b">分类</td>
			<td class="msg_category b_b">所属类别</td>
			<td class="msg_postdate b_b">发布时间</td>
			<td class="msg_act b_b">操作</td>
		</tr>
		<?php
		$rslist = $DB->DB_GetAll("SELECT * FROM msg WHERE cateid='".$cateid."'");
	  foreach($rslist AS $key=>$value)
	  {
		$value["postdate"] = date("Y-m-d H:i:s",$value["postdate"]);
		$value["modifydate"] = date("Y-m-d H:i:s",$value["modifydate"]);
		$value["v_catename"] = $STR->cut($value["catename"],8,"");
		$msglist[] = $value;
	 }

		foreach($msglist AS $key=>$value)
		{
		?>
		<tr class="m_out" onmouseover="this.className='m_over'" onmouseout="this.className='m_out'">
			<td height="25px" class="b_b"><input type="checkbox" name="qg_id[]" value="<?php echo $value['id'];?>"></td>
			<td align="center" class="b_b"><?php echo $value['id'];?></td>
			<td align="center" class="b_b"><a href="admin.php?file=content&act=list&cateid=<?php echo $value['cateid'];?>" title="<?php echo $value['catename'];?>"><?php echo $value['catename'];?></a></td>
			<td align="center" class="b_b"><?php echo $value['postdate'];?></td>
			<td align="center" class="b_b"><input type="button" value="编辑" class="mybutton_01" onclick="qg_modify(<?php echo $value['id'];?>)"></td>
		</tr>
		<?php
		}
		?>
		</table>
		
		<div class="table">
		<input type="button" value="全选" onclick="select_all()">
		<input type="button" value="反选" onclick="revCheck()">
		<input type="button" value="全不选" onclick="selectNone()">
		<input type="button" value="排序提前" onclick="qg_pl('orderdate')">
		<input type="button" value="置顶" onclick="qg_pl('top')">
		<input type="button" value="推荐" onclick="qg_pl('vouch')">
		<input type="button" value="精华" onclick="qg_pl('best')">
		<input type="button" value="审核" onclick="qg_pl('check')">
		<input type="button" value="取消置顶" onclick="qg_pl('dtop')">
		<input type="button" value="取消推荐" onclick="qg_pl('dvouch')">
		<input type="button" value="取消精华" onclick="qg_pl('dbest')">
		<input type="button" value="锁定" onclick="qg_pl('dcheck')">
		<input type="button" value="批量删除" onclick="qg_pl('delete')">
		</div>
		
		<div align="right">{:$pagelist}</div>
<?php
}
elseif($sysAct == "delete")
{
}
elseif($sysAct == "modify")
{
	
}
?>

<script type="text/javascript">
function qg_modify(id)
{
	qgurl("admin.php?file=msg&act=modify&id="+id);
}
function qg_pl(qgtype)
{
	var idarray = new Array();//定义一个数组
	var cv = document.getElementsByTagName("input");
	var m = 0;
	for(var i=0; i<cv.length; i++)
	{
		if(cv[i].type.toLowerCase() == "checkbox")
		{
			if(cv[i].checked)
			{
				idarray[m] = cv[i].value;
				m++;
			}
		}
	}
	var id = idarray.join(",");
	if(!id || id == "0")
	{
		alert("没有勾选要操作的主题！");
		return false;
	}
	var url;
	url = "admin.php?file=msg&act=plset&idlist=" + id + "&qgtype=" + qgtype + "&sysgroupid={:$sysgroupid}&cateid={:$cateid}";
	if(qgtype == "delete")
	{
		question = confirm("确认删除该信息吗？特别说明，删除后无法恢复！");
		if (question != "0")
		{
			qgurl(url);
		}
	}
	else
	{
		qgurl(url);
	}
}
</script>